package myStrangeList;

import java.util.HashMap;

public class MyStrangeList {
    private final HashMap<Cat, Boolean> map = new HashMap<>();

    public void addCat(Cat cat) {
        if (map.containsKey(cat)) {
            throw new IllegalArgumentException("A cat with the same name and age already exists.");
        }
        map.put(cat, true);
    }

    public static void main(String[] args) {
        MyStrangeList list = new MyStrangeList();


        try {
            list.addCat(new Cat("Whiskers", 3));
            list.addCat(new Cat("Paws", 2));
            list.addCat(new Cat("Bella", 5));
            System.out.println("Added different cats successfully.");


            list.addCat(new Cat("Whiskers", 3));
        } catch (IllegalArgumentException e) {
            System.out.println(e.getMessage());
        }
    }
}
